package models
{
    import com.netease.protobuf.Int64;

    import kernel.core.Core;
    import kernel.debug.Debug;
    import kernel.mvc.BaseModel;

    public class PlayerModel extends BaseModel
    {
        private var _name:String;
        private var _level:uint;
        private var _id:Int64 = Int64.ZERO;
        private var _exp:uint;
        private var _levelExp:uint;
        private var _sex:int;

        public function PlayerModel()
        {
//            trace (Core.getFromDataCatch (PlayerModel));
            //获取登陆存储的数据
            var playerObj:Object = Core.all.getByKey ("loginedPlayer");

            if (playerObj)
            {
                _id = Int64.parseInt64 (playerObj["id"]);
                _exp = playerObj["exp"];
                _level = playerObj["level"];
                _levelExp = playerObj["levelExp"];
                _name = playerObj["nickname"];
                _sex = playerObj["sex"];
            }
            else
            {

            }


        }

        public function get sex():int
        {
            return _sex;
        }

        public function get levelExp():uint
        {
            return _levelExp;
        }

        public function get exp():uint
        {
            return _exp;
        }

        public function get id():Int64
        {
            return _id;
        }

        public function get level():uint
        {
            return _level;
        }

        public function set level(value:uint):void
        {
            _level = value;
        }

        public function get name():String
        {
            return _name;
        }

    }
}
